package HelloArithmetic.Hash;


import java.util.HashMap;
import java.util.Map;

/**
 * @program: JavaDataStructure
 * @ClassName _01HashBasic
 * @description:
 * @author: jing
 * @create: 2025-07-22 15:58
 **/

public class _01HashBasic {
    public static void main(String[] args) {
        Map<Integer, String> map = new HashMap<>();
        map.put(1,"jing");
        map.put(2,"nan");
        map.put(3,"bei");

        //哈希表获取值
        String mapValue1 = map.get(1);

        //遍历哈希表value
        for(String value : map.values()){
            System.out.println(value);
        }

        //遍历整个map
        for(Map.Entry<Integer,String> mapEntry:map.entrySet()){
            System.out.printf("%d:值是%s",mapEntry.getKey(),mapEntry.getValue());
        }

        map.remove(1);

        //遍历哈希表key
        for(Integer key :map.keySet()){
            System.out.println(key);
        }


    }

}
